<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>完成盘点</title>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="css/mui.picker.css" />
		<link rel="stylesheet" type="text/css" href="css/mui.poppicker.css" />
		<link rel="stylesheet" type="text/css" href="css/complete.css" />
		<style>

		</style>
		<!--多行列表-->
		<script src="js/mui.min.js"></script>
		<script src="js/mui.picker.js"></script>
		<script src="js/mui.poppicker.js"></script>
		<script type="text/javascript" src="js/mui.pullToRefresh.js"></script>
		<script type="text/javascript" src="js/mui.pullToRefresh.material.js"></script>
		<script src="js/addressinitialization.js"></script>
		<script type="text/javascript">
			window.onload = function() {
				inventory_four_btn();
				batch_update(); //批量修改
				close_inventory(); //结束盘点
				update_msg(); //修改按钮
				Monitoring(); //监控修改属性
				selectAll(); //全选/反选

			}

			mui.plusReady(function() {
				mui.preload({
					url: 'complete_sub.html',
					id: 'complete_sub.html'
				});
				sub_page = plus.webview.getWebviewById('complete_sub.html');
			})

			/*-------------------------------------------------------------*/
			var select_active_store = null;

			function inventory_four_btn() {
				mui('.mui-slider-indicator').on('tap', 'a', function() {
					var id = this.getAttribute("id");
					if(id == 'inventory_1') {
						haveInventory_but();
					} else if(id == 'inventory_2') {
						notInventory_but();
					} else if(id == 'inventory_3') {
						abnormal_depart_but();
					} else if(id == 'inventory_4') {
						abnormal_store_but();
					}
				});
			}
			/*-------------------------------------------------------------*/
			// 监听跳转详情页
			function tap_sub_event() {
				mui(".mui-table-view-cell").on('tap', '.m-numbers-href', function() {
					var title = this.getAttribute("title");
					var id = this.getAttribute("id");
					mui.fire(sub_page, 'get_detail', {
						title_: title,
						id_: id
					});
				})
			}

			//			已盘点
			function haveInventory_but() {
				document.getElementById("selectAll").innerHTML = "全选";
				//清空main
				document.getElementById("inventory_main").innerHTML = "";
				//后端请求
				mui.ajax(IP + '/ias/AndroidInventAsset/haveInventory', {
					dataType: 'json',
					data: {
						select_store: select_active_store
					},
					type: 'post',
					timout: 5000,
					headers: {
						'Content-Type': 'application/json'
					},
					success: function(response) {
						//服务器端返回响应
						if(response.data != null) {
							mui.each(response.data, function(index, item) {
								var assetNum = item.assetNum; //资产编号
								var assetName = item.assetName; //资产名称
								var inventoryStore = item.inventoryStore; //存放地
								var inventoryDepart = item.inventoryDepart; //部门
								var inventoryBatch = item.inventoryBatch; //批次号
								var inventoryDate = item.inventoryDate; //盘点时间
								var inventoryStatus = item.inventoryStatus; //盘点状态
								var inventoryspanAdrr = item.inventoryspanAdrr; //扫描地
								var parent = document.getElementById("inventory_main");
								//var msg_div = document.getElementById(assetNum);
								var m_li = document.createElement('li');
								m_li.className = "mui-table-view-cell";
								var m_table = document.createElement('div');
								m_table.className = "mui-table";
								//console.log("资产编号："+assetNum);
								// 复选框
								var m_l_table_cell = document.createElement('div');
								m_l_table_cell.classList.add('mui-table-cell', 'mui-checkbox', 'mui-col-xs-2', 'mui-left');
								var m_l_input_check = document.createElement('input');
								m_l_input_check.name = "checkbox";
								m_l_input_check.type = "checkbox";
								m_l_input_check.value = assetNum;
								m_l_table_cell.appendChild(m_l_input_check);

								// 中间内容
								var m_c_table_cell = document.createElement('div');
								m_c_table_cell.classList.add('mui-table-cell', 'mui-col-xs-8');
								// 中间内容 1
								var m_c_row_1 = document.createElement('div');
								m_c_row_1.className = "mui-row";
								var m_c_asset_name = document.createElement('h4');
								m_c_asset_name.className = "mui-ellipsis";
								//m_c_asset_name.innerText = "资产名称:";
								var m_c_asset_span = document.createElement('span');
								m_c_asset_span.innerText = assetName;
								m_c_asset_name.appendChild(m_c_asset_span);
								m_c_row_1.appendChild(m_c_asset_name);
								// 中间内容2
								var m_c_row_2 = document.createElement('div');
								m_c_row_2.className = "mui-row";
								var m_c_row_2_col_1 = document.createElement('div');
								m_c_row_2_col_1.className = "mui-col-xs-8";
								var m_c_asset_id = document.createElement('h5');
								m_c_asset_id.className = "mui-ellipsis";
								m_c_asset_id.innerText = "资产编号";
								var m_c_asset_id_span = document.createElement('span');
								m_c_asset_id_span.innerText = assetNum;
								m_c_asset_id.appendChild(m_c_asset_id_span);
								m_c_row_2_col_1.appendChild(m_c_asset_id);
								var m_c_row_2_col_2 = document.createElement('div');
								m_c_row_2_col_2.className = "mui-col-xs-4";
								var m_c_asset_status = document.createElement('h5');
								m_c_asset_status.classList.add('mui-ellipsis', 'm-status');
								m_c_asset_status.innerText = inventoryStatus;
								m_c_row_2_col_2.appendChild(m_c_asset_status);
								m_c_row_2.appendChild(m_c_row_2_col_1);
								m_c_row_2.appendChild(m_c_row_2_col_2);

								//中间内容3
								var m_c_row_3 = document.createElement('div');
								m_c_row_3.className = "mui-row";
								var m_c_row_3_col_1 = document.createElement('div');
								m_c_row_3_col_1.className = "mui-col-xs-6";
								var m_c_asset_store = document.createElement('p');
								m_c_asset_store.className = "mui-ellipsis";
								m_c_asset_store.innerText = "存放地：";
								var m_c_asset_store_span = document.createElement('span');
								m_c_asset_store_span.innerText = inventoryStore;
								m_c_asset_store.appendChild(m_c_asset_store_span);
								m_c_row_3_col_1.appendChild(m_c_asset_store);
								var m_c_row_3_col_2 = document.createElement('div');
								m_c_row_3_col_2.className = "mui-col-xs-6";
								var m_c_asset_spanaddr = document.createElement('p');
								m_c_asset_spanaddr.className = "mui-ellipsis";
								m_c_asset_spanaddr.innerText = "扫描地：";
								var m_c_asset_spanadder_span = document.createElement('span');
								m_c_asset_spanadder_span.innerText = inventoryspanAdrr;
								m_c_asset_spanaddr.appendChild(m_c_asset_spanadder_span);
								m_c_row_3_col_2.appendChild(m_c_asset_spanaddr);
								m_c_row_3.appendChild(m_c_row_3_col_1);
								m_c_row_3.appendChild(m_c_row_3_col_2);

								//中间内容4
								var m_c_row_4 = document.createElement('div');
								m_c_row_4.className = "mui-row";
								var m_c_time = document.createElement('span');
								m_c_time.className = "mui-h5";
								m_c_time.innerText = inventoryDate;
								m_c_row_4.appendChild(m_c_time);
								m_c_table_cell.appendChild(m_c_row_1);
								m_c_table_cell.appendChild(m_c_row_2);
								m_c_table_cell.appendChild(m_c_row_3);
								m_c_table_cell.appendChild(m_c_row_4);
								// 右边详情
								var m_r_table_cell = document.createElement('div');
								m_r_table_cell.classList.add('mui-table-cell', 'mui-text-right', 'mui-col-xs-2', 'm-numbers-href');
								m_r_table_cell.title = assetName;
								m_r_table_cell.id = assetNum;

								var m_r_icon = document.createElement('a');
								m_r_icon.className = "mui-navigate-right";
								m_r_table_cell.appendChild(m_r_icon);

								m_table.appendChild(m_l_table_cell);
								m_table.appendChild(m_c_table_cell);
								m_table.appendChild(m_r_table_cell);
								m_li.appendChild(m_table);
								parent.appendChild(m_li);

							})
							document.getElementById("inventory_1").nextElementSibling.innerText = response.total;
							tap_sub_event();
						} else {
							mui.toast("已盘点信息为空");
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理
						console.log(type);
					}
				});

			}
			//			未盘点
			function notInventory_but() {

				document.getElementById("selectAll").innerHTML = "全选";

				//清空main
				document.getElementById("not_inventory_main").innerHTML = "";
				//后端请求
				mui.ajax(IP + '/ias/AndroidInventAsset/notInventory', {
					dataType: 'json',
					data: {
						select_store: select_active_store
					},
					type: 'post',
					timout: 5000,
					headers: {
						'Content-Type': 'application/json'
					},
					success: function(response) {

						//服务器端返回响应
						if(response.data != null) {
							mui.each(response.data, function(index, item) {
								var assetNum = item.assetNum; //资产编号
								var assetName = item.assetName; //资产名称
								var inventoryStore = item.inventoryStore; //存放地
								var inventoryDepart = item.inventoryDepart; //部门
								var inventoryBatch = item.inventoryBatch; //批次号
								var inventoryDate = item.inventoryDate; //盘点时间
								var inventoryStatus = item.inventoryStatus; //盘点状态
								var inventoryspanAdrr = item.inventoryspanAdrr; //扫描地
								var parent = document.getElementById("not_inventory_main");
								var m_li = document.createElement('li');
								m_li.className = "mui-table-view-cell";
								var m_table = document.createElement('div');
								m_table.className = "mui-table";
								// 复选框
								var m_l_table_cell = document.createElement('div');
								m_l_table_cell.classList.add('mui-table-cell', 'mui-checkbox', 'mui-col-xs-2', 'mui-left');
								var m_l_input_check = document.createElement('input');
								m_l_input_check.name = "checkbox";
								m_l_input_check.type = "checkbox";
								m_l_input_check.value = assetNum;
								m_l_table_cell.appendChild(m_l_input_check);

								// 中间内容
								var m_c_table_cell = document.createElement('div');
								m_c_table_cell.classList.add('mui-table-cell', 'mui-col-xs-8');
								// 中间内容 1
								var m_c_row_1 = document.createElement('div');
								m_c_row_1.className = "mui-row";
								var m_c_asset_name = document.createElement('h4');
								m_c_asset_name.className = "mui-ellipsis";
								//m_c_asset_name.innerText = "资产名称:";
								var m_c_asset_span = document.createElement('span');
								m_c_asset_span.innerText = assetName;
								m_c_asset_name.appendChild(m_c_asset_span);
								m_c_row_1.appendChild(m_c_asset_name);
								// 中间内容2
								var m_c_row_2 = document.createElement('div');
								m_c_row_2.className = "mui-row";
								var m_c_row_2_col_1 = document.createElement('div');
								m_c_row_2_col_1.className = "mui-col-xs-8";
								var m_c_asset_id = document.createElement('h5');
								m_c_asset_id.className = "mui-ellipsis";
								m_c_asset_id.innerText = "资产编号";
								var m_c_asset_id_span = document.createElement('span');
								m_c_asset_id_span.innerText = assetNum;
								m_c_asset_id.appendChild(m_c_asset_id_span);
								m_c_row_2_col_1.appendChild(m_c_asset_id);
								var m_c_row_2_col_2 = document.createElement('div');
								m_c_row_2_col_2.className = "mui-col-xs-4";
								var m_c_asset_status = document.createElement('h5');
								m_c_asset_status.classList.add('mui-ellipsis', 'm-status');
								m_c_asset_status.innerText = inventoryStatus;
								m_c_row_2_col_2.appendChild(m_c_asset_status);
								m_c_row_2.appendChild(m_c_row_2_col_1);
								m_c_row_2.appendChild(m_c_row_2_col_2);

								//中间内容3
								var m_c_row_3 = document.createElement('div');
								m_c_row_3.className = "mui-row";
								var m_c_row_3_col_1 = document.createElement('div');
								m_c_row_3_col_1.className = "mui-col-xs-6";
								var m_c_asset_store = document.createElement('p');
								m_c_asset_store.className = "mui-ellipsis";
								m_c_asset_store.innerText = "存放地：";
								var m_c_asset_store_span = document.createElement('span');
								m_c_asset_store_span.innerText = inventoryStore;
								m_c_asset_store.appendChild(m_c_asset_store_span);
								m_c_row_3_col_1.appendChild(m_c_asset_store);
								var m_c_row_3_col_2 = document.createElement('div');
								m_c_row_3_col_2.className = "mui-col-xs-6";
								var m_c_asset_spanaddr = document.createElement('p');
								m_c_asset_spanaddr.className = "mui-ellipsis";
								m_c_asset_spanaddr.innerText = "扫描地：";
								var m_c_asset_spanadder_span = document.createElement('span');
								m_c_asset_spanadder_span.innerText = inventoryspanAdrr;
								m_c_asset_spanaddr.appendChild(m_c_asset_spanadder_span);
								m_c_row_3_col_2.appendChild(m_c_asset_spanaddr);
								m_c_row_3.appendChild(m_c_row_3_col_1);
								m_c_row_3.appendChild(m_c_row_3_col_2);

								//中间内容4
								var m_c_row_4 = document.createElement('div');
								m_c_row_4.className = "mui-row";
								var m_c_time = document.createElement('span');
								m_c_time.className = "mui-h5";
								m_c_time.innerText = inventoryDate;
								m_c_row_4.appendChild(m_c_time);
								m_c_table_cell.appendChild(m_c_row_1);
								m_c_table_cell.appendChild(m_c_row_2);
								m_c_table_cell.appendChild(m_c_row_3);
								m_c_table_cell.appendChild(m_c_row_4);
								// 右边详情和时间
								var m_r_table_cell = document.createElement('div');
								m_r_table_cell.classList.add('mui-table-cell', 'mui-text-right', 'mui-col-xs-2', 'm-numbers-href');
								m_r_table_cell.title = assetName;
								m_r_table_cell.id = assetNum;
								var m_r_icon = document.createElement('a');
								m_r_icon.className = "mui-navigate-right";
								m_r_table_cell.appendChild(m_r_icon);

								m_table.appendChild(m_l_table_cell);
								m_table.appendChild(m_c_table_cell);
								m_table.appendChild(m_r_table_cell);
								m_li.appendChild(m_table);
								parent.appendChild(m_li);

							})
							document.getElementById("inventory_2").nextElementSibling.innerText = response.total;
							tap_sub_event();
						} else {
							mui.toast("未盘点信息为空");
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理
						console.log(type);
					}
				});

			}
			//          存放地异常
			function abnormal_store_but() {

				document.getElementById("selectAll").innerHTML = "全选";
				//清空main
				document.getElementById("abnormal_store_main").innerHTML = "";
				//后端请求
				mui.ajax(IP + '/ias/AndroidInventAsset/errorInventoryStore', {
					dataType: 'json',
					data: {
						select_store: select_active_store
					},
					type: 'post',
					timout: 5000,
					headers: {
						'Content-Type': 'application/json'
					},
					success: function(response) {

						//服务器端返回响应
						if(response.data != null) {
							mui.each(response.data, function(index, item) {
								var assetNum = item.assetNum; //资产编号
								var assetName = item.assetName; //资产名称
								var inventoryStore = item.inventoryStore; //存放地
								var inventoryDepart = item.inventoryDepart; //部门
								var inventoryBatch = item.inventoryBatch; //批次号
								var inventoryDate = item.inventoryDate; //盘点时间
								var inventoryStatus = item.inventoryStatus; //盘点状态
								var inventoryspanAdrr = item.inventoryspanAdrr; //扫描地
								var parent = document.getElementById("abnormal_store_main");
								//var msg_div = document.getElementById(assetNum);
								var m_li = document.createElement('li');
								m_li.className = "mui-table-view-cell";
								var m_table = document.createElement('div');
								m_table.className = "mui-table";
								// 复选框
								var m_l_table_cell = document.createElement('div');
								m_l_table_cell.classList.add('mui-table-cell', 'mui-checkbox', 'mui-col-xs-2', 'mui-left');
								var m_l_input_check = document.createElement('input');
								m_l_input_check.name = "checkbox";
								m_l_input_check.type = "checkbox";
								m_l_input_check.value = assetNum;
								m_l_table_cell.appendChild(m_l_input_check);

								// 中间内容
								var m_c_table_cell = document.createElement('div');
								m_c_table_cell.classList.add('mui-table-cell', 'mui-col-xs-8');
								// 中间内容 1
								var m_c_row_1 = document.createElement('div');
								m_c_row_1.className = "mui-row";
								var m_c_asset_name = document.createElement('h4');
								m_c_asset_name.className = "mui-ellipsis";
								//m_c_asset_name.innerText = "资产名称:";
								var m_c_asset_span = document.createElement('span');
								m_c_asset_span.innerText = assetName;
								m_c_asset_name.appendChild(m_c_asset_span);
								m_c_row_1.appendChild(m_c_asset_name);
								// 中间内容2
								var m_c_row_2 = document.createElement('div');
								m_c_row_2.className = "mui-row";
								var m_c_row_2_col_1 = document.createElement('div');
								m_c_row_2_col_1.className = "mui-col-xs-8";
								var m_c_asset_id = document.createElement('h5');
								m_c_asset_id.className = "mui-ellipsis";
								m_c_asset_id.innerText = "资产编号";
								var m_c_asset_id_span = document.createElement('span');
								m_c_asset_id_span.innerText = assetNum;
								m_c_asset_id.appendChild(m_c_asset_id_span);
								m_c_row_2_col_1.appendChild(m_c_asset_id);
								var m_c_row_2_col_2 = document.createElement('div');
								m_c_row_2_col_2.className = "mui-col-xs-4";
								var m_c_asset_status = document.createElement('h5');
								m_c_asset_status.classList.add('mui-ellipsis', 'm-status');
								m_c_asset_status.innerText = inventoryStatus;
								m_c_row_2_col_2.appendChild(m_c_asset_status);
								m_c_row_2.appendChild(m_c_row_2_col_1);
								m_c_row_2.appendChild(m_c_row_2_col_2);

								//中间内容3
								var m_c_row_3 = document.createElement('div');
								m_c_row_3.className = "mui-row";
								var m_c_row_3_col_1 = document.createElement('div');
								m_c_row_3_col_1.className = "mui-col-xs-6";
								var m_c_asset_store = document.createElement('p');
								m_c_asset_store.className = "mui-ellipsis";
								m_c_asset_store.innerText = "存放地：";
								var m_c_asset_store_span = document.createElement('span');
								m_c_asset_store_span.innerText = inventoryStore;
								m_c_asset_store.appendChild(m_c_asset_store_span);
								m_c_row_3_col_1.appendChild(m_c_asset_store);
								var m_c_row_3_col_2 = document.createElement('div');
								m_c_row_3_col_2.className = "mui-col-xs-6";
								var m_c_asset_spanaddr = document.createElement('p');
								m_c_asset_spanaddr.className = "mui-ellipsis";
								m_c_asset_spanaddr.innerText = "扫描地：";
								var m_c_asset_spanadder_span = document.createElement('span');
								m_c_asset_spanadder_span.innerText = inventoryspanAdrr;
								m_c_asset_spanaddr.appendChild(m_c_asset_spanadder_span);
								m_c_row_3_col_2.appendChild(m_c_asset_spanaddr);
								m_c_row_3.appendChild(m_c_row_3_col_1);
								m_c_row_3.appendChild(m_c_row_3_col_2);

								//中间内容4
								var m_c_row_4 = document.createElement('div');
								m_c_row_4.className = "mui-row";
								var m_c_time = document.createElement('span');
								m_c_time.className = "mui-h5";
								m_c_time.innerText = inventoryDate;
								m_c_row_4.appendChild(m_c_time);
								m_c_table_cell.appendChild(m_c_row_1);
								m_c_table_cell.appendChild(m_c_row_2);
								m_c_table_cell.appendChild(m_c_row_3);
								m_c_table_cell.appendChild(m_c_row_4);
								// 右边详情和时间
								var m_r_table_cell = document.createElement('div');
								m_r_table_cell.classList.add('mui-table-cell', 'mui-text-right', 'mui-col-xs-2', 'm-numbers-href');
								m_r_table_cell.title = assetName;
								m_r_table_cell.id = assetNum;
								var m_r_icon = document.createElement('a');
								m_r_icon.className = "mui-navigate-right";
								m_r_table_cell.appendChild(m_r_icon);

								m_table.appendChild(m_l_table_cell);
								m_table.appendChild(m_c_table_cell);
								m_table.appendChild(m_r_table_cell);
								m_li.appendChild(m_table);
								parent.appendChild(m_li);

							})
							document.getElementById("inventory_4").nextElementSibling.innerText = response.total;
							tap_sub_event();
						} else {
							mui.toast("存放地异常信息为空");
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理
						console.log(type);
					}
				});

			}
			//			部门异常
			function abnormal_depart_but() {
				document.getElementById("selectAll").innerHTML = "全选";
				//清空main
				document.getElementById("abnormal_depart_main").innerHTML = "";
				//后端请求
				mui.ajax(IP + '/ias/AndroidInventAsset/errorInventoryDepart', {
					dataType: 'json',
					data: {
						select_store: select_active_store
					},
					type: 'post',
					timout: 5000,
					headers: {
						'Content-Type': 'application/json'
					},
					success: function(response) {
						//服务器端返回响应
						if(response.data != null) {
							mui.each(response.data, function(index, item) {
								var assetNum = item.assetNum; //资产编号
								var assetName = item.assetName; //资产名称
								var inventoryStore = item.inventoryStore; //存放地
								var inventoryDepart = item.inventoryDepart; //部门
								var inventoryBatch = item.inventoryBatch; //批次号
								var inventoryDate = item.inventoryDate; //盘点时间
								var inventoryStatus = item.inventoryStatus; //盘点状态
								var inventoryspanAdrr = item.inventoryspanAdrr; //扫描地
								var parent = document.getElementById("abnormal_depart_main");
								//var msg_div = document.getElementById(assetNum);
								var m_li = document.createElement('li');
								m_li.className = "mui-table-view-cell";
								var m_table = document.createElement('div');
								m_table.className = "mui-table";
								// 复选框
								var m_l_table_cell = document.createElement('div');
								m_l_table_cell.classList.add('mui-table-cell', 'mui-checkbox', 'mui-col-xs-2', 'mui-left');
								var m_l_input_check = document.createElement('input');
								m_l_input_check.name = "checkbox";
								m_l_input_check.type = "checkbox";
								m_l_input_check.value = assetNum;
								m_l_table_cell.appendChild(m_l_input_check);

								// 中间内容
								var m_c_table_cell = document.createElement('div');
								m_c_table_cell.classList.add('mui-table-cell', 'mui-col-xs-8');
								// 中间内容 1
								var m_c_row_1 = document.createElement('div');
								m_c_row_1.className = "mui-row";
								var m_c_asset_name = document.createElement('h4');
								m_c_asset_name.className = "mui-ellipsis";
								//m_c_asset_name.innerText = "资产名称:";
								var m_c_asset_span = document.createElement('span');
								m_c_asset_span.innerText = assetName;
								m_c_asset_name.appendChild(m_c_asset_span);
								m_c_row_1.appendChild(m_c_asset_name);
								// 中间内容2
								var m_c_row_2 = document.createElement('div');
								m_c_row_2.className = "mui-row";
								var m_c_row_2_col_1 = document.createElement('div');
								m_c_row_2_col_1.className = "mui-col-xs-8";
								var m_c_asset_id = document.createElement('h5');
								m_c_asset_id.className = "mui-ellipsis";
								m_c_asset_id.innerText = "资产编号";
								var m_c_asset_id_span = document.createElement('span');
								m_c_asset_id_span.innerText = assetNum;
								m_c_asset_id.appendChild(m_c_asset_id_span);
								m_c_row_2_col_1.appendChild(m_c_asset_id);
								var m_c_row_2_col_2 = document.createElement('div');
								m_c_row_2_col_2.className = "mui-col-xs-4";
								var m_c_asset_status = document.createElement('h5');
								m_c_asset_status.classList.add('mui-ellipsis', 'm-status');
								m_c_asset_status.innerText = inventoryStatus;
								m_c_row_2_col_2.appendChild(m_c_asset_status);
								m_c_row_2.appendChild(m_c_row_2_col_1);
								m_c_row_2.appendChild(m_c_row_2_col_2);

								//中间内容3
								var m_c_row_3 = document.createElement('div');
								m_c_row_3.className = "mui-row";
								var m_c_row_3_col_1 = document.createElement('div');
								m_c_row_3_col_1.className = "mui-col-xs-6";
								var m_c_asset_store = document.createElement('p');
								m_c_asset_store.className = "mui-ellipsis";
								m_c_asset_store.innerText = "存放地：";
								var m_c_asset_store_span = document.createElement('span');
								m_c_asset_store_span.innerText = inventoryStore;
								m_c_asset_store.appendChild(m_c_asset_store_span);
								m_c_row_3_col_1.appendChild(m_c_asset_store);
								var m_c_row_3_col_2 = document.createElement('div');
								m_c_row_3_col_2.className = "mui-col-xs-6";
								var m_c_asset_spanaddr = document.createElement('p');
								m_c_asset_spanaddr.className = "mui-ellipsis";
								m_c_asset_spanaddr.innerText = "扫描地：";
								var m_c_asset_spanadder_span = document.createElement('span');
								m_c_asset_spanadder_span.innerText = inventoryspanAdrr;
								m_c_asset_spanaddr.appendChild(m_c_asset_spanadder_span);
								m_c_row_3_col_2.appendChild(m_c_asset_spanaddr);
								m_c_row_3.appendChild(m_c_row_3_col_1);
								m_c_row_3.appendChild(m_c_row_3_col_2);

								//中间内容4
								var m_c_row_4 = document.createElement('div');
								m_c_row_4.className = "mui-row";
								var m_c_time = document.createElement('span');
								m_c_time.className = "mui-h5";
								m_c_time.innerText = inventoryDate;
								m_c_row_4.appendChild(m_c_time);
								m_c_table_cell.appendChild(m_c_row_1);
								m_c_table_cell.appendChild(m_c_row_2);
								m_c_table_cell.appendChild(m_c_row_3);
								m_c_table_cell.appendChild(m_c_row_4);
								// 右边详情和时间
								var m_r_table_cell = document.createElement('div');
								m_r_table_cell.classList.add('mui-table-cell', 'mui-text-right', 'mui-col-xs-2', 'm-numbers-href');
								m_r_table_cell.title = assetName;
								m_r_table_cell.id = assetNum;
								var m_r_icon = document.createElement('a');
								m_r_icon.className = "mui-navigate-right";
								m_r_table_cell.appendChild(m_r_icon);

								m_table.appendChild(m_l_table_cell);
								m_table.appendChild(m_c_table_cell);
								m_table.appendChild(m_r_table_cell);
								m_li.appendChild(m_table);
								parent.appendChild(m_li);

							})
							document.getElementById("inventory_3").nextElementSibling.innerText = response.total;
							tap_sub_event();
						} else {
							mui.toast("部门异常信息为空");
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理
						console.log(type);
					}
				});
			}

			// 返回复选框中选中的value
			function getVal() {
				var res = getRadioRes('checkbox');
				return res;
			}
			// 获取选中的复选框的value
			function getRadioRes(className) {
				var radioArray = document.getElementsByName(className);
				var checkedArray = new Array();
				var k = 0;
				for(i = 0; i < radioArray.length; i++) {
					if(radioArray[i].checked) {
						checkedArray[k] = radioArray[i].value;
						k++;
					}

				}
				return checkedArray;
			}
			//批量修改弹出框
			function batch_update() {
				document.getElementById("update_but").addEventListener("click", function() {
					mui("#batch_msg").popover("toggle");
				});
			}
			//结束盘点
			function close_inventory() {
				document.getElementById("close_but").addEventListener('click', function() {
					//清空main
					document.getElementById("inventory_main").innerHTML = "";
					document.getElementById("not_inventory_main").innerHTML = "";
					document.getElementById("abnormal_depart_main").innerHTML = "";
					document.getElementById("abnormal_store_main").innerHTML = "";
					inventory_count = 0;
					not_inventory_count = 0;
					abnormal_store_count = 0;
					abnormal_depart_count = 0;
					mui.ajax(IP + '/ias/AndroidInventAsset/closeInventory', {
						type: 'post',
						dataType: 'json',
						timeout: 10000,
						headers: {
							'Content-Type': 'application/json'
						},
						//登陆结束
						beforeSend: function(data) {
							plus.nativeUI.showWaiting("结束中...");
						},
						success: function(data) {
							plus.nativeUI.closeWaiting();
							//window.location = "main.html";
						},
						error: function(xhr, type, errorThrown) {
							//错误处理
							mui.toast("请求失败");
							plus.nativeUI.closeWaiting();
						}
					});
				});
			}
			//首页返回键处理
			//处理逻辑：1秒内，连续两次按返回键，则返回登陆；
			/*mui.back = function() {
        	window.location="mainPage.html";
        	
       	 }*/
			//修改按钮
			function update_msg() {
				document.getElementById("update_msg").addEventListener('tap', function(e) {
					e.detail.gesture.preventDefault();
					var data = "";
					var type = mui("#update_type")[0].value;
					if(type == "盘点状态") {
						span_addr = select_active_store;
						data = mui("#inventory_status")[0].value;
					} else if(type == "损益类型") {
						data = mui("#inventory_dicprofitloss")[0].value;
					} else if(type == "领用人") {
						data = mui("#update_data")[0].value;
					} else if(type == "存放地") {
						data = mui("#inventory_store")[0].value;
					} else {
						mui.alert("错误属性");
					}
					var btnArray = ['否', '是']; //操作
					if(data == "") {
						mui.alert("请输入修改内容");
					} else {
						if(getVal() != "") {
							var assetnum = getVal();
							mui.confirm("修改属性:" + type + "                                 修改内容:" + data, '提示', btnArray, function(e) {
								if(e.index == 1) {
									if(type == "盘点状态") {
										data_ = {
											assetNum: assetnum,
											type: type,
											data: data,
											span_addr: span_addr
										}
									} else {
										data_ = {
											assetNum: assetnum,
											type: type,
											data: data
										}
									}
									//开始修改
									mui.ajax(IP + '/ias/AndroidInventAsset/batchUpdate', {
										data: data_,
										type: 'post',
										dataType: 'json',
										timeout: 10000,
										headers: {
											'Content-Type': 'application/json'
										},
										//登陆结束
										beforeSend: function(data) {
											plus.nativeUI.showWaiting("修改中...");
										},
										success: function(data) {
											if(data.result == 'error') {
												//修改失败
												plus.nativeUI.closeWaiting();
												mui.alert(data.msg);
											} else {
												//修改成功
												plus.nativeUI.closeWaiting();
												mui.alert(data.msg);
											}

										},
										error: function(xhr, type, errorThrown) {
											//错误处理
											mui.toast("请求失败");
											plus.nativeUI.closeWaiting();
										}
									})
								} else {; //取消操作
								}
							})
						} else {
							mui.alert("请选择要操作的数据");
						}
					}
				});
			}
			//取消按钮
			function update_cencel() {
				mui("#batch_msg").popover("toggle");
			}
			//监控修改属性
			function Monitoring() {
				document.getElementById("update_type").addEventListener('change', function() {
					var type = mui("#update_type")[0].value;
					if(type == "盘点状态") {
						//变为下拉框
						document.getElementById("inventory_status").style.marginTop = "20px";
						document.getElementById("inventory_status").style.display = "block";
						document.getElementById("inventory_dicprofitloss").style.display = "none";
						document.getElementById("update_data").style.display = "none";
						document.getElementById("inventory_store").style.display = "none";
						//获取所有的盘点状态
					} else if(type == "损益类型") {
						//变为下拉框
						document.getElementById("inventory_dicprofitloss").style.marginTop = "20px";
						document.getElementById("inventory_dicprofitloss").style.display = "block";
						document.getElementById("inventory_status").style.display = "none";
						document.getElementById("update_data").style.display = "none";
						document.getElementById("inventory_store").style.display = "none";
						document.getElementById("inventory_dicprofitloss").innerHTML = "";
						//获取所有的损益类型
						mui.ajax(IP + '/ias/AndroidInputAsset/listDicProfitLoss', {
							type: "GET",
							dataType: 'json',
							success: function(response) {
								var dicprofitloss = response.data;
								var selections = document.getElementById("inventory_dicprofitloss");
								for(var i = 0; i < dicprofitloss.length; i++) {
									option = document.createElement("option");
									option.value = dicprofitloss[i];
									option.text = dicprofitloss[i];
									selections.options.add(option);
								}
							},
							error: function(xhr, textStatus, errorThrown) {
								mui.alert("数据错误，请检查登陆状态");
							}
						});
					} else if(type == "领用人") {
						//变为输入框
						document.getElementById("update_data").style.marginTop = "20px";
						document.getElementById("update_data").style.display = "block";
						document.getElementById("inventory_dicprofitloss").style.display = "none";
						document.getElementById("inventory_status").style.display = "none";
						document.getElementById("inventory_store").style.display = "none";
					} else if(type == "存放地") {
						//获取本部门的所有存放地
						document.getElementById("inventory_store").style.marginTop = "20px";
						document.getElementById("inventory_store").style.display = "block";
						document.getElementById("inventory_dicprofitloss").style.display = "none";
						document.getElementById("inventory_status").style.display = "none";
						document.getElementById("update_data").style.display = "none";
						document.getElementById("inventory_store").innerHTML = "";
						mui.ajax(IP + '/ias/AndroidInputAsset/listDepartStore', {
							type: "GET",
							dataType: 'json',
							success: function(response) {
								var selections = document.getElementById("inventory_store");
								var store = response.data;
								if(store == "空") {
									mui.toast("请检查网络状态");
								} else {
									for(var i = 0; i < store.length; i++) {
										option = document.createElement("option");
										option.value = store[i];
										option.text = store[i];
										selections.options.add(option);
									}
								}
							},
							error: function(xhr, textStatus, errorThrown) {
								mui.alert("数据错误，请检查登陆状态");
							}
						});
					} else {
						mui.alert("属性错误");
					}
				});
			}
			//全选/反选
			var flag = 0;

			function selectAll() {
				document.getElementById("selectAll").addEventListener('click', function() {
					console.log("全選");
					flag++;
					var listAssetRadio = document.getElementsByName("checkbox");
					if(null != listAssetRadio) {
						if(flag % 2 != 0) {
							for(var i = 0; i < listAssetRadio.length; i++) {
								listAssetRadio[i].checked = true;
								this.style.backgroundColor = "#B5B5B5";
								document.getElementById("selectAll").innerText = "取消全选";
							}
						} else {
							for(var i = 0; i < listAssetRadio.length; i++) {
								listAssetRadio[i].checked = false;
								this.style.backgroundColor = "#007AFF";
								document.getElementById("selectAll").innerText = "全选";
							}
						}
					}
				});
			}

			function load_data() {
				// 将上一个扫描地统计盘点结果的个数清空
				document.getElementById('inventory_1').nextElementSibling.innerText = 0;
				document.getElementById('inventory_2').nextElementSibling.innerText = 0;
				document.getElementById('inventory_3').nextElementSibling.innerText = 0;
				document.getElementById('inventory_4').nextElementSibling.innerText = 0;
				//选择完扫描地就自动触发点击
				mui.trigger(document.getElementById('inventory_1'), 'tap');
				mui.trigger(document.getElementById('inventory_2'), 'tap');
				mui.trigger(document.getElementById('inventory_3'), 'tap');
				mui.trigger(document.getElementById('inventory_4'), 'tap');
			}
			(function($, doc) {
				$.ready(function() {
					var store_menu = new Array();
					mui.ajax(IP + '/ias/AndroidInputAsset/listDepartStore', {
						type: "GET",
						dataType: 'json',
						success: function(response) {
							var store = response.data;
							if(store == "空") {
								mui.confirm('数据错误，请检查登陆状态', '提示', "是", function(e) {
									if(e.index == 0) {
										window.location = "mainPage.html";
									} else {; //
									}
								});
							} else {
								for(var i = 0; i < store.length; i++) {
									store_menu[i] = {
										text: store[i]
									};
								}
								//普通示例
								var userPicker = new $.PopPicker();
								userPicker.setData(store_menu);
								var showUserPickerButton = doc.getElementById('showUserPicker');
								var userResult = doc.getElementById('userResult');
								showUserPickerButton.addEventListener('tap', function(event) {
									userPicker.show(function(items) {
										//userResult.innerText = JSON.stringify(items[0]);
										//返回 false 可以阻止选择框的关闭
										//return false;
										select_active_store = items[0].text;
										load_data();
									});
								}, false);

							}
						},
						error: function(xhr, textStatus, errorThrown) {
							mui.alert("数据错误，请检查登陆状态");
						}
					})

				});
			})(mui, document);
		</script>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<button id="showUserPicker" class="mui-btn mui-btn-link mui-icon mui-icon-search mui-pull-right">存放地</button>
			<div id='userResult' class="ui-alert"></div>
			<h1 class="mui-title">查看资产</h1>
		</header>
		<div class="mui-content">
			<div id="slider" class="mui-slider">
				<div id="sliderSegmentedControl" class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<div class="top_2_bar">
						<a id="inventory_1" class="mui-control-item" href="#item1mobile">
							已盘点
						</a>
						<span class="mui-badge mui-badge-success">0</span>
					</div>
					<div class="top_2_bar">
						<a id="inventory_2" class="mui-control-item" href="#item2mobile">
							未盘点
						</a>
						<span class="mui-badge">0</span>
					</div>
					<div class="top_2_bar">
						<a id="inventory_3" class="mui-control-item" href="#item3mobile">
							部门异常
						</a>
						<span class="mui-badge mui-badge-warning">0</span>
					</div>
					<div class="top_2_bar">
						<a id="inventory_4" class="mui-control-item" href="#item4mobile">
							存放地异常
						</a>
						<span class="mui-badge mui-badge-warning">0</span>
					</div>

				</div>
				<div id="sliderProgressBar" class="mui-slider-progress-bar mui-col-xs-3"></div>
				<div class="mui-slider-group">
					<div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
						<div id="scroll1" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<ul class="mui-table-view mui-table-view-striped mui-table-view-condensed" id="inventory_main">
									<!--<li class="mui-table-view-cell ">
											<div class="mui-table">
												<div class="mui-table-cell mui-checkbox  mui-col-xs-2 mui-left">
													<input name="checkbox" type="checkbox" value="Item 1">
												</div>
												<div class="mui-table-cell mui-col-xs-8">
													<div class="mui-row">
															<h4 class="mui-ellipsis">资产名称  <span>计算机</span> </h4>
													</div>
													<div class="mui-row">
														<div class="mui-col-sm-8 mui-col-xs-8">
															<h5>资产编号 <span>123123123</span></h5>
														</div>
														<div class="mui-col-sm-4 mui-col-xs-4">
															<h5>存放地异常</h5>
														</div>
													</div>
													<div class="mui-row">
														<div class="mui-col-sm-6 mui-col-xs-6">
															<p>存放地：<span>123123123</span></p>
														</div>
														<div class="mui-col-sm-6 mui-col-xs-6">
															<p>扫描地：<span>九层机房</span></p>
														</div>
													</div>
													<div class="row">
														<span class="mui-h5">2020-01-12</span>
													</div>
												</div>
												<div class="mui-table-cell mui-col-xs-2 mui-text-right m-numbers-href" title="计算机">
													<a class="mui-navigate-right"></a>
												</div>
											</div>
										</li>-->
								</ul>
							</div>
						</div>
					</div>
					<div id="item2mobile" class="mui-slider-item mui-control-content">
						<div id="scroll2" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<ul class="mui-table-view mui-table-view-striped mui-table-view-condensed" id="not_inventory_main">
								</ul>
							</div>
						</div>

					</div>
					<div id="item3mobile" class="mui-slider-item mui-control-content">
						<div id="scroll3" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<ul class="mui-table-view mui-table-view-striped mui-table-view-condensed" id="abnormal_depart_main">
								</ul>
							</div>
						</div>
					</div>
					<div id="item4mobile" class="mui-slider-item mui-control-content">
						<div id="scroll3" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<ul class="mui-table-view mui-table-view-striped mui-table-view-condensed" id="abnormal_store_main">
								</ul>
							</div>
						</div>
					</div>
				</div>
			</div>
			<button id="selectAll" type="button" class="mui-btn mui-btn-blue  m-operation-action">全选</button>
			<button id="update_but" type="button" class="mui-btn mui-btn-warning  m-operation-action">批量修改</button>
			<button id="close_but" type="button" class="mui-btn mui-btn-green  m-operation-action mui-action-back m-complete-inventory">结束盘点</button>
		</div>
		<!--
        	作者：984326869@qq.com
        	时间：2019-09-04
        	描述：批量修改弹窗
        -->
		<div id="batch_msg" class="mui-popover">
			<span>批量修改盘点信息</span>
			<div style="height: 60px; line-height: 60px;">
				<div style="width: 30%;float: left;"><span>选择属性:</span></div>
				<div style="width: 60%; float: left;">
					<select id="update_type" class="mui-h5">
						<option value="盘点状态">盘点状态</option>
						<option value="损益类型">损益类型</option>
						<option value="领用人">领用人</option>
						<option value="存放地">存放地</option>
					</select>
				</div>
			</div>
			<div style="height: 80px; line-height: 80px;">
				<div style="width: 30%;float: left;"><span>修改内容:</span></div>
				<div style="width: 60%; float: left;">
					<select id="inventory_status">
						<option value="已盘点">已盘点</option>
						<option value="未盘点">未盘点</option>
					</select>
					<select id="inventory_dicprofitloss" style="display: none;"></select>
					<select id="inventory_store" style="display: none;"></select>
					<input id="update_data" type="text" placeholder="请输入领用人" style="border: none; display: none;font-size: 14px;" />
				</div>
			</div>
			<div class="mui-button-row" style="margin-top: 10px;">
				<button type="button" class="mui-btn-green" id="update_msg" style="margin-left:12px ;">修改</button>
				<button type="button" class="mui-btn-yellow" onclick="update_cencel()" style="margin-left:12px;">取消</button>
			</div>
		</div>
	</body>

</html>
<script type="text/javascript">
	mui.init({
		swipeBack: false,
	})

	// 顶部选项卡跳转
	(function($) {
		$('.mui-scroll-wrapper').scroll({
			indicators: true //是否显示滚动条
		});

		var item1 = document.getElementById('item1mobile');
		var item2 = document.getElementById('item2mobile');
		var item3 = document.getElementById('item3mobile');
		var item4 = document.getElementById('item4mobile');

		var sliderSegmentedControl = document.getElementById('sliderSegmentedControl');
		$('.mui-input-group').on('change', 'input', function() {
			if(this.checked) {
				sliderSegmentedControl.className = 'mui-slider-indicator mui-segmented-control mui-segmented-control-inverted mui-segmented-control-' + this.value;
				//force repaint
				sliderProgressBar.setAttribute('style', sliderProgressBar.getAttribute('style'));
			}
		});
	})(mui);

	(function($) {
		//阻尼系数
		var deceleration = mui.os.ios ? 0.003 : 0.0009;
		$('.mui-scroll-wrapper').scroll({
			bounce: false,
			indicators: true, //是否显示滚动条
			deceleration: deceleration
		});
		$.ready(function() {
			//循环初始化所有下拉刷新，上拉加载。
			$.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
				$(pullRefreshEl).pullToRefresh({
					down: {
						callback: function() {
							var self = this;
							setTimeout(function() {
								load_data();
								self.endPullDownToRefresh();
							}, 1000);
						}
					},
				});
			});
		});
	})(mui);
</script>